#ifndef  __IPZ_MOTOR_H_	
#define	 __IPZ_MOTOR_H_	

#ifdef	IPZ_MOTOR_GLOBAL
	#define	IPZ_MOTOR_EXT	
#else
	#define	IPZ_MOTOR_EXT		extern
#endif

#define AN41908A_DGAIN_FILTER 			0x708A
#define AN41908A_PID_PARAM 				0x66F0
#define AN41908A_PWM_FILTER				0x0E10
#define AN41908A_HALL_CURRENT_OFFSET  	0x7A20 
#define AN41908A_HALL_GAIN_FILTER	    0x0404
#define AN41908A_IRIS_EN      			0x0400
#define AN41908A_IRIS_SPEED 			0x0C00

typedef enum 
{
	DRIVER_MOTOR_STOP = 0, 
	DRIVER_MOTOR_DISABLED,
	DRIVER_MOTOR_DISABLED_2,
	DRIVER_FOCUS_FLAG,
	DRIVER_ZOOM_FLAG,
	DRIVER_ZOOMC_FLAG,
	DRIVER_IRIS_FLAG,
	DRIVER_IRCUT_FLAG,
	DRIVER_ZOOM_FOCUS_FLAG,
	DRIVER_ZOOM_FOCUS_ZOOMC_IRIS_FLAG,
	DRIVER_ZOOM_FOCUS_ZOOMC_FLAG,
	DRIVER_INIT_FOCUS_FLAG,
	DRIVER_INIT_ZOOM_FLAG,
	DRIVER_INIT_ZOOMC_FLAG,
	DRIVER_INIT_IRIS_FLAG,
	DRIVER_INIT_IRCUT_FLAG,
	DRIVER_INIT_MOTOR,
	DRIVER_STATUS_NUM,
}MotorStatusDef;


typedef enum 
{
	DRIVER_MOTOR_SPEED = 0,
	DRIVER_MOTOR_SLOW	,
	DRIVER_MOTOR_NORMAL,
	DRIVER_MOTOR_NUM
	
}MotorSpeedDef;


IPZ_MOTOR_EXT SW_MUTEX hMotorMutex;

SW_INT IPZ_ZBC_MOTOR_An41908aSetParam(SW_INT dev_fd, struct an41908a_ctrl_info *info);
SW_INT IPZ_ZBC_MOTOR_An41908aGetParam(SW_INT dev_fd, struct an41908a_ctrl_info *info);
SW_INT IPZ_ZBC_MOTOR_An41908bSetParam(SW_INT dev_fd, struct an41908a_ctrl_info *info);
SW_INT IPZ_ZBC_MOTOR_An41908bGetParam(SW_INT dev_fd, struct an41908a_ctrl_info *info);
void IPZ_ZBC_MOTOR_VdIrqHandler(SW_INT sig_num);
SW_INT IPZ_ZBC_MOTOR_VdIrqThread(void);
SW_INT IPZ_ZBC_MOTOR_An41908Init(void);
SW_INT  IPZ_ZBC_MOTOR_MotorInit(void);
SW_INT IPZ_ZBC_MOTOR_DriverZoomFocus(SW_INT focusDir,SW_UINT8 focusStep,SW_INT zoomDir,SW_UINT8 zoomStep);
SW_INT IPZ_ZBC_MOTOR_DriverZoomIris(SW_INT IrisDir,SW_UINT8 IrisStep,SW_INT zoomDir,SW_UINT8 zoomStep);
SW_INT IPZ_ZBC_MOTOR_DriverIrcut(SW_INT IrcutDir,SW_UINT8 IrcutStep);
SW_INT  IPZ_ZBC_MOTOR_SetLensPI(void);
SW_INT  IPZ_ZBC_MOTOR_ClearLensPI(void);
SW_INT IPZ_ZBC_MOTOR_SetICRState(SW_INT value);
SW_BOOL IPZ_ZBC_MOTOR_ReadZoomSensor(void);
SW_BOOL IPZ_ZBC_MOTOR_ReadZoomCSensor(void);
SW_BOOL IPZ_ZBC_MOTOR_ReadFocusSensor(void);
SW_BOOL IPZ_ZBC_MOTOR_ReadIrisSensor(void);
SW_BOOL IPZ_ZBC_MOTOR_ReadIrcutSensor(void);
SW_INT IPZ_ZBC_MOTOR_MotorStop(SW_INT s32flag);
SW_INT	IPZ_ZBC_MOTOR_MotorRun(SW_UINT MotorFlag);
SW_INT IPZ_ZBC_MOTOR_SetFPS(SW_DOUBLE dfps);
SW_INT IPZ_ZBC_GetHallPos(void);
SW_INT  IPZ_ZBC_MOTOR_SetIrisPos(SW_INT duty);





#endif
